// pages/tabBar/tabBar.js
var app = getApp();
Component({
	properties:{
		selected:{
			type:'Number',
			value:''
		},
	},
	data: {
		actionsheet:false,
		"color": "#666666",
		"selectedColor": "#f10b2e",
		"list": [{
				"pagePath": "/pages/index/index",
				"text": "招聘",
				"iconPath": "/style/icon/wjj.png",
				"selectedIconPath": "/style/icon/wjj-active.png",
				"type": "tabber",
			},
			{
				"pagePath": "/pages/driver/driver",
				"text": "驾驶员",
				"iconPath": "/style/icon/driver.png",
				"selectedIconPath": "/style/icon/driver-active.png",
				"type": "tabber",
			},
			{
				"text": "发布",
				"iconPath": "/style/icon/plus.png",
				"selectedIconPath": "/style/icon/plus.png",
				"type": "publish",
			},
			{
				"pagePath": "/pages/report/report",
				"text": "举报",
				"iconPath": "/style/icon/report.png",
				"selectedIconPath": "/style/icon/report-active.png",
				"type": "tabber",
			},
			{
				"pagePath": "/pages/me/me",
				"text": "我的",
				"iconPath": "/style/icon/me.png",
				"selectedIconPath": "/style/icon/me-active.png",
				"type": "user",
			}
		]
	},
	attached() {},
	methods: {
		tabberPopupClose(){
			this.setData({
				actionsheet:false
			});
		},
		linkrecruit(){
			this.setData({
				actionsheet:false
			});
			wx.navigateTo({
				url: '../recruit/recruit',
			});
		},
		linkrjianli(){
			this.setData({
				actionsheet:false
			});
			wx.navigateTo({
				url: '../jianli/jianli',
			});
		},
		switchTab(e) {
			const data = e.currentTarget.dataset
			const url = data.path;
			if(data.type == 'publish'){
				if(!app.globalData.hasUserInfo){
					app.handleLogin();
					return false;
				}
				this.setData({
					actionsheet:true
				});
			}else{
				if(data.type == 'user'){
					if(!app.globalData.hasUserInfo){
						app.handleLogin();
						return false;
					}
				}
				wx.reLaunch({
				  url: url
				});
			}
			
		}
	}
})
